/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ModelToTree.impl;

import BoardGame.Figure;

import ModelToTree.ModelToTreePackage;
import ModelToTree.ModelToTreeTransformerUtils;

import java.lang.reflect.InvocationTargetException;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Transformer Utils</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * </p>
 *
 * @generated
 */
public class ModelToTreeTransformerUtilsImpl extends EObjectImpl implements
		ModelToTreeTransformerUtils {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ModelToTreeTransformerUtilsImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelToTreePackage.Literals.MODEL_TO_TREE_TRANSFORMER_UTILS;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public String charForFigure(Figure figure) {
		if (null == figure)
			throw new IllegalArgumentException("Figure must not be null!");
		
		final String className = figure.eClass().getName();
		String result = className.substring(0, 1);
		if (className.contains("Black"))
		{
			result = result.toLowerCase();
		}
		else
		{
			result = result.toUpperCase();
		}
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eInvoke(int operationID, EList<?> arguments)
			throws InvocationTargetException {
		switch (operationID) {
		case ModelToTreePackage.MODEL_TO_TREE_TRANSFORMER_UTILS___CHAR_FOR_FIGURE__FIGURE:
			return charForFigure((Figure) arguments.get(0));
		}
		return super.eInvoke(operationID, arguments);
	}

} //ModelToTreeTransformerUtilsImpl
